home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / com_and3.zip / FILEMGR.CMD < prev    next >
OS/2 REXX Batch file  |  1990-07-10  |  24KB  |  842 lines

  1.    SET TTHRU OFF        ; Make first to allow typeahead
  2.    S15 = "\PE.EXE"              ; Set your word processor name here
  3. ; ----- FileMgr: File manager shell for COM-AND
  4. ;
  5. ;    R.McG; 7/89, Chicago
  6. ; ----------------------------------------------------------------
  7. ;    Note: You should change the second line above to specify the
  8. ;    name of the word processor you typically use.  When invoked
  9. ;    the file name to be edited is appended to the program name,
  10. ;    (e.g. equivalend to "d> PE file.txt").  If this is not appro-
  11. ;    priate, you must change the logic at the end of this script.
  12. ; ----------------------------------------------------------------
  13. ; Usages:
  14. ;    S19 -----> Legend line
  15. ;    S18 -----> Load-time drive:subdirectory (for exit)
  16. ;    S17 -----> Load-time download d:subdir (for exit)
  17. ;    S16 -----> Current file mask (for DIR function)
  18. ;    S15 -----> Editor or wordprocessor program file name
  19. ;
  20. ;    N99 -----> Number of lines on screen
  21. ;    N92 -----> Current cursor
  22. ;    N91 -----> Current cursor
  23. ;    N90 -----> Current screen highlight (1 to N99-6)
  24. ;
  25. ;    FLAG(2) -> Off if we are on left side of the display
  26. ; -----------------------------------------------------------------------
  27. ;
  28. ;    Initialization
  29. ;
  30.    CURSOR N91,N92        ; Read current cursor
  31.    S19 = "FileMgr ver 1.0     " ; 20 chars long
  32.    LEGEND S19            ; Set initial legend
  33.    SUBDIR S18            ; Read current subdir
  34.    DLDIR S17            ; Read current download subdir
  35.    SSIZE N99            ; get current screen size
  36.    SAVE 0,0,N99-2,79        ; Save original screen
  37.    ON ESCAPE GOSUB ESCAPE    ; Escape action
  38.    S16 = "*.*"                  ; Set default mask
  39. ;
  40. ;    Ask for a directory change, and then start
  41. ;
  42.    GOSUB Ask_Dir        ; Ask for a directory change
  43.    GOTO START            ; And continue
  44. ;
  45. ;    Escape - Clear all windows, and exit
  46. ;
  47. Escape:
  48.    SET DLDIR S17        ; Reset DLDIR  to load time
  49.    CHDIR S18            ; Reset default subdir to load time
  50.    RESTORE            ; Restore screen
  51.    LOCATE N91,N92        ; Restore cursor
  52.    EXIT             ; End script
  53. ;
  54. ;    Draw the screen, and decide if we're linked
  55. ;
  56. Start:
  57.    GOSUB Screen         ; Draw screen
  58.    GOSUB DispFirst        ; Build our directory list
  59.    N90 = 1            ; Set initial cursor
  60.    SET FLAG(2) OFF        ; On Left of display
  61.    GOSUB Set_Cursor        ; Set 1st cursor
  62. ;
  63. ;    We have a keypress pending
  64. ;
  65. Main:
  66.    KEYGET S1            ; Read a single key
  67.    SWITCH S1
  68.       CASE "4D00"               ; Cursor_Right
  69.      GOSUB Change_Sides
  70.       ENDCASE
  71.       CASE "4B00"               ; Cursor left
  72.      GOSUB Change_Sides
  73.       ENDCASE
  74.       CASE "4900"               ; PgUp
  75.      GOSUB Prev_Page
  76.       ENDCASE
  77.       CASE "5100"               ; PgDn
  78.      GOSUB Next_Page
  79.       ENDCASE
  80.       CASE "4700"               ; Home
  81.      GOSUB Home_Page
  82.       ENDCASE
  83.       CASE "4F00"               ; End
  84.      GOSUB End_Page
  85.       ENDCASE
  86.       CASE "4800"               ; Cursor Up
  87.      GOSUB Cursor_Up
  88.       ENDCASE
  89.       CASE "5000"               ; Cursor down
  90.      GOSUB Cursor_Down
  91.       ENDCASE
  92.       CASE "7100"               ; Alt-F10
  93.      SHELL
  94.       ENDCASE
  95.       CASE "5200"               ; INS key
  96.      GOSUB DOS
  97.       ENDCASE
  98.  
  99.       CASE "N"                  ; Change directory
  100.      GOSUB NewDir
  101.       ENDCASE
  102.       CASE "U"                  ; Upload a file
  103.      GOSUB Upld
  104.       ENDCASE
  105.       CASE "H"                  ; Help
  106.      GOSUB Help
  107.       ENDCASE
  108.       CASE "S"                  ; Send
  109.      GOSUB Send
  110.       ENDCASE
  111.       CASE "F"                  ; Free space
  112.      GOSUB Free
  113.       ENDCASE
  114.       CASE "V"                  ; View a file
  115.      GOSUB View
  116.       ENDCASE
  117.       CASE "W"                  ; Wordprocessor
  118.      GOSUB Word
  119.       ENDCASE
  120.       CASE "E"                  ; Execute a program
  121.      GOSUB EXEC
  122.       ENDCASE
  123.       CASE "C"                  ; Copy a file
  124.      GOSUB Copy
  125.       ENDCASE
  126.       CASE "D"                  ; Delete a file
  127.      GOSUB Delete
  128.       ENDCASE
  129.       CASE "R"                  ; Rename
  130.      GOSUB Rename
  131.       ENDCASE
  132.       CASE "M"                  ; New mask
  133.      GOSUB Mask
  134.       ENDCASE
  135.  
  136.       DEFAULT
  137.     SOUND 100,100        ; Signal displeasure
  138.       ENDCASE
  139.    ENDSWITCH
  140.    GOTO Main            ; And continue
  141. ;
  142. ; ----- Subroutine: Read the line at the current highlight
  143. ;    .. according to the current seting of FLAG(2)
  144. ;    S12 returns the line at the current cursor
  145. ;
  146. Read_Cursor:
  147.     S12 = ""
  148.     IF NOT ZERO N90
  149.        IF FLAG(2)        ; IF true we're on Remote
  150.           ATSCR N90,41,37 S12
  151.        ELSE
  152.           ATSCR N90, 2,37 S12
  153.           ENDIF
  154.        ENDIF
  155.     RETURN
  156. ;
  157. ; ----- Subroutine: Clear the current highlight
  158. ;    .. according to the current setting of FLAG(2)
  159. ;
  160. Clear_Cursor:
  161.     IF NOT ZERO N90
  162.        GOSUB Read_Cursor
  163.        IF FLAG(2)        ; IF true we're on remote
  164.           ATSAY N90,41 (default) S12
  165.        ELSE
  166.           ATSAY N90, 2 (default) S12
  167.           ENDIF
  168.        ENDIF
  169.     RETURN
  170. ;
  171. ; ----- Subroutine: Display the current highlight
  172. ;    .. according to the current stting of FLAG(2)
  173. ;
  174. Set_Cursor:
  175.     GOSUB Read_Cursor
  176.     IF NOT ZERO N90
  177.        IF FLAG(2)        ; IF true we're on remote
  178.           IF NOT NULL S12
  179.          ATSAY N90,41 (contrast) S12
  180.           ELSE
  181.          N90 = N90-1
  182.          GOTO Set_Cursor
  183.          ENDIF
  184.        ELSE         ; On own side
  185.           IF NOT NULL S12
  186.          ATSAY N90, 2 (contrast) S12
  187.           ELSE
  188.          N90 = N90-1
  189.          GOTO Set_Cursor
  190.          ENDIF
  191.           ENDIF
  192.        ENDIF
  193.     RETURN
  194. ;
  195. ; ----- Subroutine: Move the cursor Up
  196. ;
  197. Cursor_Up:
  198.     GOSUB Clear_Cursor
  199.     IF GT N90 1
  200.        N90 = N90-1
  201.     ELSE
  202.        N90 = N99-6
  203.        ENDIF
  204.     GOSUB Set_Cursor
  205.     RETURN
  206. ;
  207. ; ----- Subroutine: Move the cursor Down
  208. ;
  209. Cursor_Down:
  210.     GOSUB Clear_Cursor
  211.     IF LT N90 (N99-6)
  212.        N90 = N90+1
  213.     ELSE
  214.        N90 = 1
  215.        ENDIF
  216.     GOSUB Set_Cursor
  217.     RETURN
  218. ;
  219. ; ----- Subroutine: Change the display side
  220. ;
  221. Change_Sides:
  222.     GOSUB Clear_Cursor    ; Clear cursor if any
  223.     IF FLAG(2)        ; IF true we're on right
  224.        SET FLAG(2) OFF    ; .. make it left
  225.     ELSE            ; etc
  226.        SET FLAG(2) ON
  227.        ENDIF
  228.     GOSUB Set_Cursor    ; And renew cursor
  229.     RETURN
  230. ;
  231. ; ----- Subroutine: Clear a window - right or left
  232. ;    .. according to the current stting of FLAG(2)
  233. ;
  234. Clear_Window:
  235.     IF FLAG(2)        ; IF true we're on remote
  236.        SCROLL 0,1,40,(N99-6),77 (default)
  237.     ELSE
  238.        SCROLL 0,1,1,(N99-6),38 (default)
  239.        ENDIF
  240.     N90 = 0         ; Clear current cursor
  241.     RETURN
  242. ;
  243. ; ----- Subroutine: Display the previous page
  244. ;
  245. Prev_Page:
  246.     SOUND 55,500        ; Unimplemented
  247.     RETURN
  248. ;
  249. ; ----- Subroutine:  Display the next page
  250. ;
  251. Next_Page:
  252.     GOSUB DispNext        ; Display next page
  253.     N90 = 1         ; Set initial cursor
  254.     SET FLAG(2) OFF     ; On Left of display
  255.     GOSUB Set_Cursor    ; And reset cursor
  256.     RETURN
  257. ;
  258. ; ----- Subroutine:  Set to the home page
  259. ;
  260. Home_Page:
  261.     GOSUB DispFirst     ; Display first page
  262.     N90 = 1         ; Set initial cursor
  263.     SET FLAG(2) OFF     ; On Left of display
  264.     GOSUB Set_Cursor    ; And reset cursor
  265.     RETURN
  266. ;
  267. ; ----- Subroutine:  Find the ending page
  268. ;
  269. End_Page:
  270.     SOUND 55,500        ; Unimplemented
  271.     RETURN
  272. ;
  273. ; ----- Subroutine: Display first page of directory
  274. ;
  275. DispFirst:
  276.    FFIRST S16           ; Initialize
  277.    IF Failure           ; If not found
  278.       RETURN           ; Quit here
  279.       ENDIF
  280. ;
  281. ; ----- Subroutine: Display directory using current position
  282. ;    Note: Cursor is repositioned to top left
  283. ;
  284. DispNext:
  285.    N90 =  1           ; Clear current cursor
  286.    SET FLAG(2) ON       ; Clear right side
  287.    GOSUB Clear_Window       ; ..
  288.    SET FLAG(2) OFF       ; Clear left side
  289.    GOSUB Clear_Window       ; ..
  290.  
  291.    N1 = 1           ; Set loop counter
  292. ;
  293. ;    Read and display the file names
  294. ;
  295. DINE100:
  296.    FNEXT S1           ; Get next file name
  297.    IF Failure           ; If end of list
  298.       IF LE N1 1       ; If empty screen
  299.      GOTO DispFirst    ; Restart
  300.      ENDIF
  301.       RETURN           ; Else, quit
  302.       ENDIF
  303. ;
  304. ;    Skip subdirectory files
  305. ;
  306.    IF STRCMP S1(1:1) "."   ; Skip parent subdir
  307.       GOTO DINE100       ; SKip this file
  308.       ENDIF
  309. ;
  310. ;    Skip subdirectories
  311. ;
  312.    FATTR S2 S1           ; Get attribute
  313.    IF STRCMP S2(3:3) "1"   ; If a subdirectory
  314.       GOTO DINE100       ; Goto endloop
  315.       ENDIF
  316. ;
  317. ;    Get remaining information and build the display line
  318. ;
  319.    FSIZE S2 S1           ; Get file size
  320.    FDATE S3 S1           ; Get file date
  321.    FTIME S4 S1           ; Get file time
  322.    S1(13:79) = S2       ; Set size
  323.    S1(21:79) = S3       ; Set date
  324.    S1(31:79) = S4       ; Set time
  325.    S1(39) = " "            ; Make last char blank
  326. ;
  327. ;    Write the information to disc, and display the line
  328. ;
  329.    IF GE (N99-6),N1       ; If within 1st column
  330.       ATSAY N1,2 (default) S1(0:35) ; And display
  331.    ELSE
  332.       IF GE (N99-6)*2,N1   ; If within 2nd column
  333.      ATSAY (N1-(N99-6)),41 (default) S1(0:35) ; And display
  334.       ELSE
  335.      RETURN
  336.      ENDIF
  337.       ENDIF
  338.    INC N1           ; Count the line
  339.    GOTO DINE100        ; And continue
  340. ;
  341. ; ----- Subroutine: Draw the basic screen box
  342. ;
  343. Screen:
  344.    BOX     0, 0, (N99-2) ,78 (default)
  345.    ATSAY 0, 3  (default) " FileMgr "
  346.  
  347.    ATSAY N99-5,0  (default) "├─────────────────────────────────────────────────────────────────────────────┤"
  348.    ATSAY N99-4,2  (default) " , , PgUp, PgDn, Home, End, INS key (to run DOS commands), Alt-F10, H)elp"
  349.    ATSAY N99-3,2  (Default) "N)ewdir, U)pld, S)end, F)ree, V)iew, W)ord, E)xec, C)opy, D)el, R)en, M)ask"
  350.    ATSAY N99-2,28 (Default) " Press ESC to terminate "
  351.    RETURN
  352. ;
  353. ; ----- Subroutine: Help
  354. ;
  355. Help:
  356.    WOPEN  0, 0,23,78 (default) HELPESC
  357.    ATSAY  0, 2 (Default) " FileMgr "
  358.    ATSAY 23,28 (Default) " Press any key to continue "
  359. ;
  360. ;    Help message
  361. ;
  362.    ATSAY  1,2 (default) "C)opy .......... Copy the highlighted file somewhere else"
  363.    ATSAY  2,2 (default) "D)el ........... Delete the highlighted file all together "
  364.    ATSAY  3,2 (default) "E)xec .......... Run the highlighted file as a program"
  365.    ATSAY  4,2 (default) "F)ree .......... Show space left on the default drive"
  366.    ATSAY  5,2 (default) "M)ask .......... Set new search mask (default *.*)"
  367.    ATSAY  6,2 (default) "N)ewdir ........ Change directories"
  368.    ATSAY  7,2 (default) "R)en ........... Rename the highlighted file  "
  369.    ATSAY  8,2 (default) "S)end .......... Send highlighted file name through the modem"
  370.    ATSAY  9,2 (default) "U)pld .......... Upload highlighted file with protocol"
  371.    ATSAY 10,2 (default) "V)iew .......... Read the highlighted file (with DOS TYPE command)"
  372.    ATSAY 11,2 (default) "W)ord .......... Use a word processor on the highlighted file."
  373.  
  374.    ATSAY 13,2 (default) "INS key........ Run any other DOS command."
  375.    ATSAY 14,2 (default) " key ......... (Cursor down)  Move the cursor down"
  376.    ATSAY 15,2 (default) " key ......... (Cursor up)    Move the cursor up"
  377.    ATSAY 16,2 (default) "> key ......... (Cursor right) Move the cursor left"
  378.    ATSAY 17,2 (default) "< key ......... (Cursor left)  Move the cursor right"
  379.    ATSAY 18,2 (default) "PgUp key ...... Previous page of display"
  380.    ATSAY 19,2 (default) "PgDn key ...... Next page of display (circular)"
  381.    ATSAY 20,2 (default) "Home key ...... First page of display"
  382.    ATSAY 21,2 (default) "End key ....... Last page of display"
  383.    ATSAY 22,2 (default) "Alt-F10 ....... Shell to DOS (type 'EXIT' to return)"
  384. ;
  385. ;    Wait for a keypress, and return
  386. ;
  387.    KEYGET S0
  388.    WCLOSE
  389.    RETURN
  390.    ;
  391.    ;    ESCAPE during this screen
  392.    ;
  393. HELPESC:
  394.    RETURN
  395. ;
  396. ; ----- Subroutine:  Change directory
  397. ;
  398. NewDir:
  399.    GOSUB Ask_Dir       ; Try to change dir
  400.    IF SUCCESS           ; If it happened
  401.       WCLOSE           ; Close current dir window (if any)
  402.       GOSUB Screen       ; Draw screen
  403.       GOSUB DispFirst       ; Build our directory list
  404.       N90 = 1           ; Set initial cursor
  405.       SET FLAG(2) OFF       ; On Left of display
  406.       GOSUB Set_Cursor       ; Set 1st cursor
  407.       ENDIF
  408.    RETURN
  409. ;
  410. ; ----- Subroutine: Display the current subdirectory, and ask if to change
  411. ;    SUCCESS returns fact of CHDIR or no
  412. ;
  413. Ask_Dir:
  414.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  415.    ATSAY 10 12 (contrast) " File Mgr NewDir "
  416.    ATSAY 11 12 (contrast) "Current subdir: "*"_SUBDIR"
  417.    ATSAY 12 12 (contrast) "Enter a new subdir, or <cr> to continue:"
  418.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  419.  
  420.    ATGET 13 12 (contrast) 54 S0 ; Read new subdir
  421.    WCLOSE
  422.    ;
  423.    ;       Attempt to execute the entry
  424.    ;
  425.    IF NOT NULL S0        ; If nothing entered
  426.       CHDIR S0            ; Attempt to change
  427.       SET SUCCESS ON        ; Indicate success
  428.    ELSE
  429.       SET SUCCESS OFF
  430.       ENDIF
  431.    RETURN            ; And done
  432. ;
  433. ; ----- Escape during a subwindow
  434. ;    .. S0 is returned null
  435. ;
  436. Ask_Esc:
  437.    S0 = ""                      ; Make a null return
  438.    RETURN
  439. ;
  440. ; ----- Subroutine:  Set new mask
  441. ;
  442. Mask:
  443.    GOSUB Ask_Mask       ; Try to change dir
  444.    IF SUCCESS           ; If it happened
  445.       WCLOSE           ; Close current dir window (if any)
  446.       GOSUB Screen       ; Draw screen
  447.       GOSUB DispFirst       ; Build our directory list
  448.       N90 = 1           ; Set initial cursor
  449.       SET FLAG(2) OFF       ; On Left of display
  450.       GOSUB Set_Cursor       ; Set 1st cursor
  451.       ENDIF
  452.    RETURN
  453. ;
  454. ; ----- Subroutine: Display the current mask and ask for a change
  455. ;    SUCCESS returns fact of change
  456. ;
  457. Ask_Mask:
  458.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  459.    ATSAY 10 12 (contrast) " File Mgr Mask "
  460.    ATSAY 11 12 (contrast) "Current mask: "*S16
  461.    ATSAY 12 12 (contrast) "Enter a new mask, or <cr> to continue:"
  462.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  463.  
  464.    ATGET 13 12 (contrast) 54 S0 ; Read new mask
  465.    WCLOSE
  466.    ;
  467.    ;       Attempt to execute the entry
  468.    ;
  469.    IF NOT NULL S0        ; If nothing entered
  470.       S16 = S0            ; Attempt to change
  471.       SET SUCCESS ON        ; Indicate success
  472.    ELSE
  473.       SET SUCCESS OFF
  474.       ENDIF
  475.    RETURN            ; And done
  476. ;
  477. ; ----- Subroutine: Rename a file
  478. ;
  479. Rename:
  480.    GOSUB Ask_Rename       ; Try to change dir
  481.    IF SUCCESS           ; If it happened
  482.       RENAME S12 S0       ; Attempt to change
  483.       IF SUCCESS       ; Indicate success
  484.      IF FLAG(2)       ; IF true we're on remote
  485.         ATSAY N90,41 (contrast) S0(0:10)
  486.      ELSE           ; On own side
  487.         ATSAY N90, 2 (contrast) S0(0:10)
  488.         ENDIF
  489.       ELSE
  490.      S0 = "Rename to "*S0&" failed"
  491.      GOSUB Error
  492.      SET SUCCESS OFF
  493.      ENDIF
  494.       ENDIF
  495.    RETURN
  496. ;
  497. ; ----- Subroutine: Fatal error.  Open a window, and display a message
  498. ;    S0 passes the error message(s)
  499. ;
  500. Error:
  501.    WOPEN 10,10,12,70 (contrast) Err_Esc
  502.    ATSAY 10,12 (contrast) " File Mgr Error "
  503.    ATSAY 11,12 (contrast) S0(0:55); Max msg width 55 chars
  504.    ATSAY 12,26 (contrast) " Press any key to continue "
  505.    ;
  506.    ;    Wait a keypress
  507.    ;
  508.    KEYGET S0               ; Wait for any key
  509.    WCLOSE
  510.    RETURN
  511.    ;
  512.    ;    Escape during this screen
  513.    ;
  514. Err_Esc:
  515.    RETURN
  516. ;
  517. ; ----- Subroutine: Ask for a file's new name
  518. ;    SUCCESS returns fact of change
  519. ;    S12 returns the file name
  520. ;
  521. Ask_Rename:
  522.    GOSUB Read_Cursor        ; S12 returns current highlight
  523.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  524.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  525.    ATSAY 10 12 (contrast) " File Mgr Rename "
  526.    ATSAY 11 12 (contrast) "Current file: "*S12
  527.    ATSAY 12 12 (contrast) "Enter a new name, or <cr> to continue:"
  528.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  529.  
  530.    ATGET 13 12 (contrast) 11 S0 ; Read new fname
  531.    WCLOSE
  532.    ;
  533.    ;       Test the response
  534.    ;
  535.    LJ S0            ; Left justify
  536.    S0 = S0&""                   ; Trim trailing spaces
  537.    IF NOT NULL S0        ; If nothing entered
  538.       SET SUCCESS ON
  539.    ELSE
  540.       SET SUCCESS OFF
  541.       ENDIF
  542.    RETURN            ; And done
  543. ;
  544. ; ----- Subroutine: Delete a file
  545. ;
  546. Delete:
  547.    GOSUB Ask_Delete       ; Ask for y/n
  548.    IF SUCCESS           ; If yes
  549.       DELETE S12       ; Attempt to change
  550.       IF SUCCESS       ; Indicate success
  551.      IF FLAG(2)       ; IF true we're on remote
  552.         ATSAY N90,41 (contrast) "<deleted>                            "
  553.      ELSE           ; On own side
  554.         ATSAY N90, 2 (contrast) "<deleted>                            "
  555.         ENDIF
  556.       ELSE
  557.      S0 = "Delete of "*S12&" failed"
  558.      GOSUB Error
  559.      SET SUCCESS OFF
  560.      ENDIF
  561.       ENDIF
  562.    RETURN
  563. ;
  564. ; ----- Subroutine: Ask if a file is to be really and truely deleted
  565. ;    SUCCESS returns fact of y/n
  566. ;    S12 returns the file name
  567. ;
  568. Ask_Delete:
  569.    GOSUB Read_Cursor        ; S12 returns current highlight
  570.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  571.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  572.    ATSAY 10 12 (contrast) " File Mgr Delete "
  573.    ATSAY 11 12 (contrast) "Current file: "*S12
  574.    ATSAY 12 12 (contrast) "Do you wish to delete the file Y/N (cr = N)?:"
  575.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  576.  
  577.    ATGET 13 12 (contrast) 1 S0 ; Read y/n
  578.    WCLOSE
  579.    ;
  580.    ;       Interperet the response
  581.    ;
  582.    IF FIND S0 "Y"               ; If yes
  583.       SET SUCCESS ON
  584.    ELSE
  585.       SET SUCCESS OFF
  586.       ENDIF
  587.    RETURN            ; And done
  588. ;
  589. ; ----- Subroutine: Send file name out the comm port
  590. ;
  591. Send:
  592.    GOSUB Read_Cursor        ; S12 returns current highlight
  593.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  594.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  595.    ATSAY 10 12 (contrast) " File Mgr Send "
  596.    ATSAY 11 12 (contrast) "Current file: "*S12
  597.    ATSAY 12 12 (contrast) "Do you wish send this file name Y/N (cr = N)?:"
  598.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  599.  
  600.    ATGET 13 12 (contrast) 1 S0 ; Read y/n
  601.    WCLOSE
  602.    ;
  603.    ;       Interperet the response
  604.    ;
  605.    IF FIND S0 "Y"               ; If yes
  606.       PRESERVE S12        ; Make sendable
  607.       TRANSMIT S12*"!"          ; Xmit w/c/r
  608.       ENDIF
  609.    RETURN            ; And done
  610. ;
  611. ; ----- Subroutine: Free space report
  612. ;
  613. Free:
  614.    FREE S0 ""                   ; Use default drive
  615.    LJ S0            ; .. left justify
  616.    WOPEN 10,10,13,70 (contrast) Free_Esc
  617.    ATSAY 10,12 (contrast) " File Mgr Free  "
  618.    ATSAY 11,12 (contrast) "Current subdir: "*"_SUBDIR"
  619.    ATSAY 12,12 (contrast) "Free space is:  "*S0
  620.    ATSAY 13,26 (contrast) " Press any key to continue "
  621.    ;
  622.    ;    Wait a keypress
  623.    ;
  624.    KEYGET S0            ; Wait for any key
  625.    WCLOSE
  626.    RETURN
  627.    ;
  628.    ;    ESCAPE during this screen
  629.    ;
  630. Free_Esc:
  631.    RETURN
  632. ;
  633. ; ----- Subroutine:  Execute a DOS command
  634. ;
  635. DOS:
  636.    GOSUB Ask_Cmd        ; Ask for command
  637.    IF SUCCESS            ; If non-null string rtnd
  638.       DOS S0            ; Attempt to execute it
  639.       ENDIF
  640.    RETURN
  641. ;
  642. ; ----- Subroutine: Ask for a DOS command
  643. ;    SUCCESS returns fact of a nonnull string in S0
  644. ;
  645. Ask_Cmd:
  646.    WOPEN 10  0 13 78 (contrast) ASK_ESC
  647.    ATSAY 10  2 (contrast) " File Mgr DOS "
  648.    ATSAY 11  2 (contrast) "Enter a DOS command:"
  649.    ATSAY 13 21 (contrast) " Press ESC to cancel "
  650.  
  651.    ATGET 12  2 (contrast) 72 S0 ; Read new mask
  652.    WCLOSE
  653.    ;
  654.    ;       Interpret the response
  655.    ;
  656.    IF NOT NULL S0        ; If nothing entered
  657.       SET SUCCESS ON        ; Indicate success
  658.    ELSE
  659.       SET SUCCESS OFF
  660.       ENDIF
  661.    RETURN            ; And done
  662. ;
  663. ; ----- Subroutine:  Copy current file
  664. ;
  665. Copy:
  666.    GOSUB Ask_Copy       ; Ask for target
  667.    IF SUCCESS           ; If yes
  668.       DOS "COPY "*S12*" "*S0
  669.       IF FAILED        ; If failure returned
  670.      S0 = "Copy of "*S12&" failed"
  671.      GOSUB Error
  672.      ENDIF
  673.       ENDIF
  674.    RETURN
  675. ;
  676. ; ----- Subroutine: Ask for the target of a copy
  677. ;    SUCCESS returns fact of change
  678. ;    S12 returns the from file name, S0 returns the 'to'
  679. ;
  680. Ask_Copy:
  681.    GOSUB Read_Cursor        ; S12 returns current highlight
  682.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  683.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  684.    ATSAY 10 12 (contrast) " File Mgr Copy "
  685.    ATSAY 11 12 (contrast) "Current file: "*S12
  686.    ATSAY 12 12 (contrast) "Enter the destination of the copy (or CR to continue):"
  687.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  688.  
  689.    ATGET 13 12 (contrast) 54 S0 ; Read new fname
  690.    WCLOSE
  691.    ;
  692.    ;       Test the response
  693.    ;
  694.    LJ S0            ; Left justify
  695.    S0 = S0&""                   ; Trim trailing spaces
  696.    IF NOT NULL S0        ; If nothing entered
  697.       SET SUCCESS ON
  698.    ELSE
  699.       SET SUCCESS OFF
  700.       ENDIF
  701.    RETURN            ; And done
  702. ;
  703. ; ----- Subroutine:  Execute a program
  704. ;
  705. Exec:
  706.    GOSUB Read_Cursor        ; S12 returns current highlight
  707.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  708.    IF FIND S12 ".BAT"           ; Look for a batch file
  709.       DOS S12
  710.    ELSE
  711.       IF (FIND S12 ".EXE" or FIND S12 ".COM")
  712.      SAVE 0,0,N99-2,79    ; Save current screen
  713.      RUN S12
  714.      RESTORE        ; Restore screen
  715.       ELSE
  716.      S0 = "Target file is not a BATch file or a program (COM or EXE)"
  717.      GOSUB Error
  718.      ENDIF
  719.       ENDIF
  720.    RETURN            ; And done
  721. ;
  722. ; ----- Subroutine:  View a file
  723. ;
  724. View:
  725.    GOSUB Read_Cursor        ; S12 returns current highlight
  726.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  727.    IF NOT NULL S12
  728.       SAVE  0,0 N99-2,79
  729.       CLEAR (text)
  730.       LOCATE 0,0
  731.       TYPE S12
  732.       RESTORE
  733.       ENDIF
  734.    RETURN            ; And done
  735. ;
  736. ; ----- Subroutine:  Upload current file
  737. ;
  738. UpLd:
  739.    GOSUB Ask_Upld
  740.    SWITCH S0
  741.       CASE "_NULL"              ; No entry
  742.       ENDCASE            ; .. no action
  743.       CASE "1"                  ; WXMODEM
  744.      SENDFILE WXMODEM S12
  745.       ENDCASE
  746.       CASE "2"                  ; XMODEM
  747.      SENDFILE XMODEM S12
  748.       ENDCASE
  749.       CASE "3"                  ; ASCII
  750.      SENDFILE ASCII S12
  751.       ENDCASE
  752.       CASE "4"                  ; YMODEM/XMODEM1K
  753.      SENDFILE YMODEM S12
  754.       ENDCASE
  755.       CASE "5"                  ; CISB
  756.      SENDFILE CISB S12
  757.       ENDCASE
  758.       CASE "6"                  ; QuickB
  759.      SENDFILE QuickB  S12
  760.       ENDCASE
  761.       CASE "7"                  ; KERMIT
  762.      SENDFILE KERMIT S12
  763.       ENDCASE
  764.       CASE "8"                  ; Batch YMODEM
  765.      SENDFILE BYMODEM S12
  766.       ENDCASE
  767.       CASE "9"                  ; Batch YMODEM-G
  768.      SENDFILE BYMOG S12
  769.       ENDCASE
  770.  
  771.       DEFAULT
  772.     SOUND 100,100        ; Signal displeasure
  773.       ENDCASE
  774.    ENDSWITCH
  775.    RETURN
  776. ;
  777. ; ----- Subroutine: Ask for the upload method
  778. ;    S0 returns the selected method # (1-9) or null
  779. ;    S12 returns the from file name
  780. ;
  781. Ask_Upld:
  782.    GOSUB Read_Cursor        ; S12 returns current highlight
  783.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  784.    WOPEN  2 20 16 60 (contrast) ASK_ESC
  785.    ATSAY  2 22 (contrast) " File Mgr UpLd "
  786.    ATSAY  3 22 (contrast) "Current file: "*S12
  787.    ATSAY  4 20 (contrast)  "├───────────────────────────────────────┤"
  788.    ATSAY  5 22 (contrast) " 1) Windowed XMODEM"
  789.    ATSAY  6 22 (contrast) " 2) CRC/Checksum XMODEM"
  790.    ATSAY  7 22 (contrast) " 3) ASCII transfer "
  791.    ATSAY  8 22 (contrast) " 4) YMODEM/XMODEM-1K"
  792.    ATSAY  9 22 (contrast) " 5) CIS-B          "
  793.    ATSAY 10 22 (contrast) " 6) CIS Quick-B    "
  794.    ATSAY 11 22 (contrast) " 7) Kermit         "
  795.    ATSAY 12 22 (contrast) " 8) Batch YMODEM   "
  796.    ATSAY 13 22 (contrast) " 9) Batch YMODEM-G "
  797.    ATSAY 14 20 (contrast)  "├───────────────────────────────────────┤"
  798.    ATSAY 15 22 (contrast) "Enter method #:"
  799.    ATSAY 16 30 (contrast) " Press ESC to cancel "
  800.  
  801.    ATGET 15 48 (contrast) 1 S0 ; Read new fname
  802.    WCLOSE
  803.    RETURN            ; And done
  804. ;
  805. ; ----- Subroutine:  Invoke a word processor
  806. ;
  807. Word:
  808.    IF NOT NULL S17        ; Only ask once
  809.       GOTO WORD100
  810.       ENDIF
  811. ;
  812. ;    Open a window and ask for the WORDor's name
  813. ;
  814.    WOPEN 10,1  13,78 (default) Ask_Esc
  815.    ATSAY 10,3  (default) " FileMgr Word "
  816.    ATSAY 11,3  (default) "Enter the editor's name, fully qualified (e.g. C:\PE.EXE)."
  817.    ATSAY 12,3  (default) "-> "
  818.    ATSAY 13,30 (default) " Press ESC to cancel "
  819.    ATGET 12,6  (default) 50 S0    ; Ask_Esc clears S0, so we use it
  820.    WCLOSE
  821.  
  822.    IF NULL S0            ; Return on empty answer
  823.       RETURN
  824.       ENDIF
  825.    S15 = S0
  826. ;
  827. ;    Get the file name
  828. ;
  829. WORD100:
  830.    GOSUB Read_Cursor        ; S12 returns current highlight
  831.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  832. ;
  833. ;    If not null, perform the request
  834. ;
  835.    IF NOT NULL S12
  836.       RUN S15 * " " *S12        ; Make upper case
  837.       IF FAILED
  838.      S15 = ""               ; Clear S17 if failed
  839.      ENDIF
  840.       ENDIF
  841.    RETURN
  842.